package org.jinxing.utils;

import javax.servlet.http.HttpServletRequest;

import org.jinxing.model.UsersInfo;

/**
 * servelt级别的公用方法
 * @author jinxing
 *
 */
public class ServletUtils {
	public static final String User_Key = "USER_KEY";
	
	public static UsersInfo getLgUser(HttpServletRequest request){
		UsersInfo info = null;
		try {
			info = (UsersInfo) request.getSession().getAttribute(User_Key);
		} catch (Exception e) {
		}
		return info;
	}
	
	public static void registerLgUser(HttpServletRequest request,UsersInfo userInfo){
		request.getSession().setAttribute(User_Key, userInfo);
	}
	
	public static void removeLgUser(HttpServletRequest request){
		request.getSession().removeAttribute(User_Key);
	}
}
